import styled from 'styled-components'
import Icon from '@/components/Icon'
export const IconRemove = styled(Icon)`
	width: 14px;
	height: 14px;
	background-position: -77px -245px;
`
export interface WrapProps {
	readonly checked: boolean
	readonly indexWidth?: number
}
export const Wrap = styled.div.attrs((props: WrapProps) => ({
	className: props.checked ? 'checked' : '',
}))<WrapProps>`
	height: 30px;
	line-height: 30px;
	margin: 2px 0;
	user-select: none;
	cursor: pointer;
	position: relative;
	&:hover {
		color: #fff;
		background: url()
			no-repeat #5eb9ef;
		background: linear-gradient(90deg, #2d8bc0, #53afe4);
		.icon-checkbox {
			background-position: -237px -1672px;
		}
	}
	&.checked,
	&.checked:hover {
		color: #fff;
		background: url()
			no-repeat #5eb9ef;
		background: linear-gradient(90deg, #2d8bc0, #53afe4);
		.icon-checkbox {
			background-position: -93px -1672px;
		}
	}
	> div {
		float: left;
	}
	.checkbox-wrap {
		width: 26px;
		height: 30px;
		text-align: center;
		padding-top: 1px;
		box-sizing: border-box;
	}
	.item-index {
		width: ${(props) => props.indexWidth + 'px'};
		margin-right: 6px;
	}
	.avatar {
		margin-right: 10px;
		height: 30px;
		line-height: 30px;
		padding-top: 3px;
		box-sizing: border-box;
	}
	.name {
		width: ${(props) => `calc(100% - 26px - ${props.indexWidth}px - 6px - 24px - 10px - 25px)`};
		pre {
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}
	}
	.remove {
		position: absolute;
		right: 12px;
		top: 50%;
		margin-top: -11px;
	}
`
